#!/usr/bin/python
# -*- coding:UTF-8 -*-

from schema import XiaoneiMethod

AUTH_CREATE_TOKEN=XiaoneiMethod("xiaonei.auth.createToken")
AUTH_GET_SESSION=XiaoneiMethod("xiaonei.auth.getSession", 1)

FRIENDS_GET_FRIENDS=XiaoneiMethod("xiaonei.friends.getFriends", 2)
FRIENDS_GET_APP_USERS=XiaoneiMethod("xiaonei.friends.getAppUsers")
FRIENDS_ARE_FRIENDS=XiaoneiMethod("xiaonei.friends.areFriends", 2)
FRIENDS_GET=XiaoneiMethod("xiaonei.friends.get", 1)

USERS_GET_INFO=XiaoneiMethod("xiaonei.users.getInfo", 2)
USERS_GET_LOGGED_IN_USER=XiaoneiMethod("xiaonei.users.getLoggedInUser", 1)
USERS_IS_APP_ADDED=XiaoneiMethod("xiaonei.users.isAppAdded")

PROFILE_SET_XNML=XiaoneiMethod("xiaonei.profile.setXNML", 4)
PROFILE_GET_XNML=XiaoneiMethod("xiaonei.profile.getXNML", 1)
XNML_REFRESH_REF_URL=XiaoneiMethod("xiaonei.xnml.refreshRefUrl", 1)
XNML_SET_REF_HANDLE=XiaoneiMethod("xiaonei.xnml.setRefHandle", 2)

FEED_PUBLISH_STORY_TO_USER=XiaoneiMethod("xiaonei.feed.publishStoryToUser", 11)
FEED_PUBLISH_TEMPLATIZED_ACTION=XiaoneiMethod("xiaonei.feed.publishTemplatizedAction", 15)

NOTIFICATIONS_SEND=XiaoneiMethod("xiaonei.notifications.send",4)
REQUESTS_SEND_REQUEST=XiaoneiMethod("xiaonei.requests.sendRequest",2)
INVITATIONS_GET_OS_INFO=XiaoneiMethod("xiaonei.invitations.getOsInfo",2)

preAuth=[AUTH_CREATE_TOKEN,AUTH_GET_SESSION]
postAuth=[]

for x in locals().keys():
    if isinstance(locals()[x],XiaoneiMethod):
        postAuth.append(locals()[x])

for x in preAuth:
    postAuth.remove(x)

def requireSession(m):
    return m in postAuth
    
if __name__=="__main__":
    print 'Unit test: XiaoneiMethod'
    print postAuth